package com.xja.security.service.imp;

import com.xja.security.entity.Admin;
import com.xja.security.service.AdminService;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * @author 周广瑞
 * @date 2022/4/12 14:45
 */
@Service
public class AdminServiceImpl implements AdminService {
    List<Admin> adminList = new ArrayList<>();

    public AdminServiceImpl() {
        adminList.add(new Admin(1,"zhangsan","1"));
        adminList.add(new Admin(2,"lisi-","1"));
        adminList.add(new Admin(3,"王五","1"));
        adminList.add(new Admin(4,"翁郑虎","1"));
    }

    @Override
    public Admin login(String userName) {
        for (Admin admin: adminList){
            if (userName.equals(admin.getaName()))
                return admin;
        }
        return null;
    }
}
